import { Layout } from '@/utils/routerHelper'

const { t } = useI18n()
/**
 * redirect: noredirect        当设置 noredirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'          设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
 hidden: true              当设置 true 的时候该路由不会再侧边栏出现 如404，login等页面(默认 false)

 alwaysShow: true          当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式，
 只有一个时，会将那个子路由当做根路由显示在侧边栏，
 若你想不管路由下面的 children 声明的个数都显示你的根路由，
 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，
 一直显示根路由(默认 false)

 title: 'title'            设置该路由在侧边栏和面包屑中展示的名字

 icon: 'svg-name'          设置该路由的图标

 noCache: true             如果设置为true，则不会被 <keep-alive> 缓存(默认 false)

 breadcrumb: false         如果设置为false，则不会在breadcrumb面包屑中显示(默认 true)

 affix: true               如果设置为true，则会一直固定在tag项中(默认 false)

 noTagsView: true          如果设置为true，则不会出现在tag中(默认 false)

 activeMenu: '/dashboard'  显示高亮的路由路径

 followAuth: '/dashboard'  跟随哪个路由进行权限过滤

 canTo: true               设置为true即使hidden为true，也依然可以进行路由跳转(默认 false)
 }
 **/
const remainingRouter: AppRouteRecordRaw[] = [
  {
    path: '/redirect',
    component: Layout,
    name: 'Redirect',
    children: [
      {
        path: '/redirect/:path(.*)',
        name: 'Redirect',
        component: () => import('@/views/Redirect/Redirect.vue'),
        meta: {}
      }
    ],
    meta: {
      hidden: true,
      noTagsView: true
    }
  },
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    name: 'Home',
    meta: {},
    children: [
      {
        path: 'index',
        component: () => import('@/views/Home/Index.vue'),
        name: 'Index',
        meta: {
          title: t('router.home'),
          icon: 'ep:home-filled',
          noCache: false,
          affix: true
        }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    name: 'UserInfo',
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'profile',
        component: () => import('@/views/Profile/Index.vue'),
        name: 'Profile',
        meta: {
          canTo: true,
          hidden: true,
          noTagsView: false,
          icon: 'ep:user',
          title: t('common.profile')
        }
      },
      {
        path: 'notify-message',
        component: () => import('@/views/system/notify/my/index.vue'),
        name: 'MyNotifyMessage',
        meta: {
          canTo: true,
          hidden: true,
          noTagsView: false,
          icon: 'ep:message',
          title: '我的站内信'
        }
      }
    ]
  },
  {
    path: '/dict',
    component: Layout,
    name: 'dict',
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'type/data',
        component: () => import('@/views/system/dict/data/index.vue'),
        name: 'SystemDictData',
        meta: {
          title: '字典数据',
          noCache: true,
          hidden: true,
          canTo: true,
          icon: '',
          activeMenu: '/system/dict'
        }
      }
    ]
  },
  {
    path: '/codegen',
    component: Layout,
    name: 'CodegenEdit',
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'edit',
        component: () => import('@/views/infra/codegen/EditTable.vue'),
        name: 'InfraCodegenEditTable',
        meta: {
          noCache: true,
          hidden: true,
          canTo: true,
          icon: 'ep:edit',
          title: '修改生成配置',
          activeMenu: 'infra/codegen/index'
        }
      }
    ]
  },
  {
    path: '/job',
    component: Layout,
    name: 'JobL',
    meta: {
      hidden: true
    },
    children: [
      {
        path: 'job-log',
        component: () => import('@/views/infra/job/logger/index.vue'),
        name: 'InfraJobLog',
        meta: {
          noCache: true,
          hidden: true,
          canTo: true,
          icon: 'ep:edit',
          title: '调度日志',
          activeMenu: 'infra/job/index'
        }
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/Login/Login.vue'),
    name: 'Login',
    meta: {
      hidden: true,
      title: t('router.login'),
      noTagsView: true
    }
  },
  {
    path: '/sso',
    component: () => import('@/views/Login/Login.vue'),
    name: 'SSOLogin',
    meta: {
      hidden: true,
      title: t('router.login'),
      noTagsView: true
    }
  },
  {
    path: '/social-login',
    component: () => import('@/views/Login/SocialLogin.vue'),
    name: 'SocialLogin',
    meta: {
      hidden: true,
      title: t('router.socialLogin'),
      noTagsView: true
    }
  },
  {
    path: '/403',
    component: () => import('@/views/Error/403.vue'),
    name: 'NoAccess',
    meta: {
      hidden: true,
      title: '403',
      noTagsView: true
    }
  },
  {
    path: '/404',
    component: () => import('@/views/Error/404.vue'),
    name: 'NoFound',
    meta: {
      hidden: true,
      title: '404',
      noTagsView: true
    }
  },
  {
    path: '/500',
    component: () => import('@/views/Error/500.vue'),
    name: 'Error',
    meta: {
      hidden: true,
      title: '500',
      noTagsView: true
    }
  }, 
  {
    path: '/system',
    component: Layout,
    name: '/system',
    meta: {
      title: '系统管理',
      icon: 'ep:tools',
      hidden: false,
      noCache: false,
      alwaysShow: false
    },
    children: [
      {
        path: 'tenant',
        name: 'Tenant',
        meta: {
          title: '租户管理',
          icon: 'fa-solid:house-user',
          hidden: false,
          noCache: false,
          alwaysShow: false
        },
        children: [
          {
            path: 'list',
            component: () => import('@/views/system/tenant/index.vue'),
            name: 'SystemTenant',
            meta: {
              title: '租户列表',
              icon: 'ep:house',
              hidden: false,
              noCache: false
            }
          }
        ]
      },
      {
        path: 'user',
        component: () => import('@/views/system/user/index.vue'),
        name: 'SystemUser',
        meta: {
          title: '用户管理',
          icon: 'ep:avatar',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'role',
        component: () => import('@/views/system/role/index.vue'),
        name: 'SystemRole',
        meta: {
          title: '角色管理',
          icon: 'ep:user',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'menu',
        component: () => import('@/views/system/menu/index.vue'),
        name: 'SystemMenu',
        meta: {
          title: '菜单管理',
          icon: 'ep:menu',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'dept',
        component: () => import('@/views/system/dept/index.vue'),
        name: 'SystemDept',
        meta: {
          title: '部门管理',
          icon: 'fa:address-card',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'post',
        component: () => import('@/views/system/post/index.vue'),
        name: 'SystemPost',
        meta: {
          title: '岗位管理',
          icon: 'fa:address-book-o',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'dict',
        component: () => import('@/views/system/dict/index.vue'),
        name: 'SystemDict',
        meta: {
          title: '字典管理',
          icon: 'fa:address-book-o',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'messages',
        name: 'Messages',
        meta: {
          title: '消息中心',
          icon: 'ep:chat-dot-round',
          hidden: false,
          noCache: false,
          alwaysShow: false
        },
        children: [
          {
            path: 'sms',
            name: 'Sms',
            meta: {
              title: '短信管理',
              icon: 'ep:message',
              hidden: false,
              noCache: false
            },
            children: [
              {
                path: 'sms-channel',
                component: () => import('@/views/system/sms/channel/index.vue'),
                name: 'SystemSmsChannel',
                meta: {
                  title: '短信渠道',
                  icon: 'fa:stack-exchange',
                  hidden: false,
                  noCache: false
                }
              },
              {
                path: 'sms-template',
                component: () => import('@/views/system/sms/template/index.vue'),
                name: 'SystemSmsTemplate',
                meta: {
                  title: '短信模板',
                  icon: 'ep:connection',
                  hidden: false,
                  noCache: false
                }
              },
              {
                path: 'sms-log',
                component: () => import('@/views/system/sms/log/index.vue'),
                name: 'SystemSmsLog',
                meta: {
                  title: '短信日志',
                  icon: 'fa:edit',
                  hidden: false,
                  noCache: false
                }
              }
            ]
          },
          {
            path: 'system/alert/index',
            name: 'System/alert/index',
            meta: {
              title: '预警管理',
              icon: 'ep:bell',
              hidden: false,
              noCache: false,
              alwaysShow: true
            },
            children: [
              {
                path: 'system/alert/index',
                component: () => import('@/views/system/alert/index.vue'),
                name: 'Alert',
                meta: {
                  title: '预警查询',
                  icon: 'ep:bell',
                  hidden: false,
                  noCache: false
                }
              }
            ]
          },
          {
            path: 'mail',
            name: 'Mail',
            meta: {
              title: '邮箱管理',
              icon: 'fa-solid:mail-bulk',
              hidden: false,
              noCache: false
            },
            children: [
              {
                path: 'mail-account',
                component: () => import('@/views/system/mail/account/index.vue'),
                name: 'SystemMailAccount',
                meta: {
                  title: '邮箱账号',
                  icon: 'fa:universal-access',
                  hidden: false,
                  noCache: false
                }
              },
              {
                path: 'mail-template',
                component: () => import('@/views/system/mail/template/index.vue'),
                name: 'SystemMailTemplate',
                meta: {
                  title: '邮件模版',
                  icon: 'fa:tag',
                  hidden: false,
                  noCache: false
                }
              },
              {
                path: 'mail-log',
                component: () => import('@/views/system/mail/log/index.vue'),
                name: 'SystemMailLog',
                meta: {
                  title: '邮件记录',
                  icon: 'fa:edit',
                  hidden: false,
                  noCache: false
                }
              }
            ]
          },
          {
            path: 'notify',
            name: 'Notify',
            meta: {
              title: '站内信管理',
              icon: 'ep:message-box',
              hidden: false,
              noCache: false
            },
            children: [
              {
                path: 'notify-template',
                component: () => import('@/views/system/notify/template/index.vue'),
                name: 'SystemNotifyTemplate',
                meta: {
                  title: '模板管理',
                  icon: 'fa:archive',
                  hidden: false,
                  noCache: false
                }
              },
              {
                path: 'notify-message',
                component: () => import('@/views/system/notify/message/index.vue'),
                name: 'SystemNotifyMessage',
                meta: {
                  title: '消息记录',
                  icon: 'fa:edit',
                  hidden: false,
                  noCache: false
                }
              }
            ]
          },
          {
            path: 'notice',
            component: () => import('@/views/system/notice/index.vue'),
            name: 'SystemNotice',
            meta: {
              title: '通知公告',
              icon: 'ep:takeaway-box',
              hidden: false,
              noCache: false
            }
          }
        ]
      },
      {
        path: 'log',
        name: 'Log',
        meta: {
          title: '审计日志',
          icon: 'ep:document-copy',
          hidden: false,
          noCache: false
        },
        children: [
          {
            path: 'operate-log',
            component: () => import('@/views/system/operatelog/index.vue'),
            name: 'SystemOperateLog',
            meta: {
              title: '操作日志',
              icon: 'ep:position',
              hidden: false,
              noCache: false
            }
          },
          {
            path: 'login-log',
            component: () => import('@/views/system/loginlog/index.vue'),
            name: 'SystemLoginLog',
            meta: {
              title: '登录日志',
              icon: 'ep:promotion',
              hidden: false,
              noCache: false
            }
          }
        ]
      },
      {
        path: 'oauth2',
        name: 'Oauth2',
        meta: {
          title: 'OAuth 2.0',
          icon: 'fa:dashcube',
          hidden: false,
          noCache: false
        },
        children: [
          {
            path: 'oauth2/application',
            component: () => import('@/views/system/oauth2/client/index.vue'),
            name: 'SystemOAuth2Client',
            meta: {
              title: '应用管理',
              icon: 'fa:hdd-o',
              hidden: false,
              noCache: false
            }
          },
          {
            path: 'token',
            component: () => import('@/views/system/oauth2/token/index.vue'),
            name: 'SystemTokenClient',
            meta: {
              title: '令牌管理',
              icon: 'fa:key',
              hidden: false,
              noCache: false
            }
          }
        ]
      },
      {
        path: 'social',
        name: 'Social',
        meta: {
          title: '三方登录',
          icon: 'fa:rocket',
          hidden: false,
          noCache: false
        },
        children: [
          {
            path: 'client',
            component: () => import('@/views/system/social/client/index.vue'),
            name: 'SocialClient',
            meta: {
              title: '三方应用',
              icon: 'ep:set-up',
              hidden: false,
              noCache: false
            }
          },
          {
            path: 'user',
            component: () => import('@/views/system/social/user/index.vue'),
            name: 'SocialUser',
            meta: {
              title: '三方用户',
              icon: 'ep:avatar',
              hidden: false,
              noCache: false
            }
          }
        ]
      }
    ]
  },
  {
    path: '/infra',
    component: Layout,
    name: '/infra',
    meta: {
      title: '基础设施',
      icon: 'ep:monitor',
      hidden: false,
      noCache: false,
      alwaysShow: false
    },
    children: [
      {
        path: 'codegen',
        component: () => import('@/views/infra/codegen/index.vue'),
        name: 'InfraCodegen',
        meta: {
          title: '代码生成',
          icon: 'ep:document-copy',
          hidden: false,
          noCache: false
        }
      },

      {
        path: 'data-source-config',
        component: () => import('@/views/infra/dataSourceConfig/index.vue'),
        name: 'InfraDataSourceConfig',
        meta: {
          title: '数据源配置',
          icon: 'ep:data-analysis',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'swagger',
        component: () => import('@/views/infra/swagger/index.vue'),
        name: 'InfraSwagger',
        meta: {
          title: 'API 接口',
          icon: 'fa:fighter-jet',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'log',
        name: 'Log',
        meta: {
          title: 'API 日志',
          icon: 'fa:tasks',
          hidden: false,
          noCache: false
        },
        children: [
          {
            path: 'api-access-log',
            component: () => import('@/views/infra/apiAccessLog/index.vue'),
            name: 'InfraApiAccessLog',
            meta: {
              title: '访问日志',
              icon: 'ep:place',
              hidden: false,
              noCache: false
            }
          },
          {
            path: 'api-error-log',
            component: () => import('@/views/infra/apiErrorLog/index.vue'),
            name: 'InfraApiErrorLog',
            meta: {
              title: '错误日志',
              icon: 'ep:warning-filled',
              hidden: false,
              noCache: false
            }
          }
        ]
      },
      {
        path: 'websocket',
        component: () => import('@/views/infra/webSocket/index.vue'),
        name: 'InfraWebSocket',
        meta: {
          title: 'WebSocket',
          icon: 'ep:connection',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'job',
        component: () => import('@/views/infra/job/index.vue'),
        name: 'InfraJob',
        meta: {
          title: '定时任务',
          icon: 'fa-solid:tasks',
          hidden: false,
          noCache: false
        }
      },
      {
        path: 'config',
        component: () => import('@/views/infra/config/index.vue'),
        name: 'InfraConfig',
        meta: {
          title: '配置管理',
          icon: 'fa:connectdevelop',
          hidden: false,
          noCache: false
        }
      }
    ]
  }
]

export default remainingRouter
